home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / Utilities / Installer v3.4.3 / Examples - Installer 3.4 / AppTooBigForOneFloppy.r < prev    next >
Encoding:
Text File  |  1993-06-15  |  9.3 KB  |  254 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: demonstrates file splitting
  6.  *
  7.  *    File:        AppTooBigForOneFloppy.r -    Rez Source
  8.  *
  9.  *  Modifications:
  10.  *        5/19/93: RRK Changed Target file spec typeCrMustMatch flag setting to
  11.  *                        typeCrNeedNotMatch and included comment that this will
  12.  *                        allow the replacement of the target file if for some reason
  13.  *                        the file or creator are different.
  14.  *                     Used InstallerCommon.r defines.
  15.  *
  16.  *    by:            Jon Zap
  17.  *  updated for use with Installer 3.4 by: Rich Kubota 9/1/92
  18.  *
  19.  *    Copyright © 1991 Apple Computer, Inc.
  20.  *    All rights reserved.
  21.  *
  22.  *------------------------------------------------------------------------------
  23.  *
  24.  * Install application "TheProgram" into the folder "Root":Installed Application.
  25.  * It demonstrates both Easy and Custom Installation.  For the Easy Installation
  26.  * it checks the amount of target system memory and will not do the installation
  27.  * if there is less than 1mb.  There are two source floppies, each containing
  28.  * part of the application that is too large to fit on a single floppy.  The second
  29.  * floppy has a file that contains a number of resources that the application needs.
  30.  * each of these resources is moved into the app via an 'inra' resource.
  31.  * This relies on the fact that file atoms are installed before resource atoms.
  32.  * You cannot set the tgtRequired flag in the 'inra' resources because the installer
  33.  * will check before it installs any files.
  34.  *----------------------------------------------------------------------------*/
  35.  
  36. #include "Types.r"                    /* for the ICON resource */
  37. #include "InstallerTypes.r"
  38. #include "InstallerCommon.r"        /* list of macros to simplify list */
  39.  
  40. /* You can build the script with the following lines:
  41. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  42. # or set up folders with the same names and contents as the floppies
  43. # put these folders in the same folder as the script or at the root directory of same disk
  44.  
  45.     rez -o "AppTooBigForOneFloppy" -t 'bbkr' -c 'bbkr' "AppTooBigForOneFloppy.r"
  46.     setfile -a i "AppTooBigForOneFloppy"        #mark Inited
  47.     scriptcheck -p "AppTooBigForOneFloppy"
  48. */
  49.  
  50. #define kMinMemMB                01    /* memory needed to install (UPDATE Error Message if changed!)*/
  51.  
  52. /* Definitions for the rules */
  53. #define rlCheckMemSize            1000
  54. #define rlOutputMemSizeError    1001
  55.  
  56. /* Definitions for the file spec atoms (specifications for source and destination files) */
  57. #define fsSourceProgram            2000
  58. #define fsTargetProgram            2001
  59. #define fsSourceProgRes1        2002
  60.  
  61. /* These are the names of the source disks */
  62. #define ProgramDisk1 "Program Disk 1:"
  63. #define ProgramDisk2 "Program Disk 2:"
  64.  
  65. /* where we want to install our file. */
  66. #define TargetPath    ":Installed Application:"
  67.  
  68. /* Definition for the package.  */
  69. #define pkTheProgram            3000
  70.  
  71. /* Definition for the file atom */
  72. #define faProgram                4000
  73.  
  74. /* Definitions for the resource atoms */
  75. #define raProgramRes1            5000
  76. #define raProgramRes2            5001
  77. #define raProgramRes3            5002
  78. #define raProgramRes4            5003
  79.  
  80. /* Definition for the package comment resource */
  81. #define cmtTheProgram            6000
  82.  
  83. /* May 19, 1993 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  84. /* this value to a LongInt seconds value needed by the Installer. */
  85. #define currentReleaseDate        5191993    
  86. #define currentVersion            102     /* Version 1.0.2 goes in the 'icmt' rsrc */
  87.  
  88. #define iconTheProgram            5100
  89.  
  90. /************************** Easy Install Rule resources **********************************/
  91. resource 'infr' (1) {
  92.     format0  {{
  93.         pickFirst,    {rlCheckMemSize, rlOutputMemSizeError}, /* Select only one of these rules */
  94.     }};
  95. };
  96.  
  97. resource 'inrl' (rlCheckMemSize) {
  98.     format0 {{
  99.         /* If the system has at least kMinMemMB megs of memory, then add the package */
  100.         checkMinMemory {kMinMemMB},
  101.         addUserDescription {"Click the Install button to install\n"}, /* message to appear in Easy Install screen */
  102.         addUserDescription {"• The Program\n"},    
  103.         addPackages {{pkTheProgram}},            /* we're installing the program */
  104.     }};
  105. };
  106.  
  107. resource 'inrl' (rlOutputMemSizeError) {
  108.     format0 {{
  109.         /* This error message will be displayed on the Easy Install screen if this rule */
  110.         /* fires.  It fires if the first rule in this pickFirst group does not fire */
  111.         reportSysError {"To do installation you need:\n\n"},
  112.         reportSysError {"• At least 1 megabyte of memory\n"}
  113.     }};
  114. };
  115.  
  116. /***************************** Package Resources ************************************************/
  117. resource 'inpk' (pkTheProgram) {
  118.     format0 {
  119.         showsOnCustom,                 /* Package appears in the Custom Install display */
  120.         removable,                    /* Package can be removed */
  121.         dontForceRestart,            /* installing an app doesn't require rebooting */
  122.         cmtTheProgram,                 /* package's 'icmt' resource id */
  123.         0,                            /* Package size (filled in by ScriptCheck) */
  124.         "TheProgram", {                /* package name for package that shows on custom */
  125.             'infa', faProgram;
  126.             'inra', raProgramRes1;
  127.             'inra', raProgramRes2;
  128.             'inra', raProgramRes3;
  129.             'inra', raProgramRes4;
  130.         }
  131.     }
  132. };
  133.  
  134. /***************************** Comments ************************************************/
  135. resource 'icmt' (cmtTheProgram) {
  136.     currentReleaseDate,
  137.     currentVersion,
  138.     iconTheProgram,
  139.     "This package contains TheProgram."
  140. };
  141.  
  142. resource 'ICON' (iconTheProgram) {
  143.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  144.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  145.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  146.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  147.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  148.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  149.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  150.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  151. };
  152.  
  153.  
  154. /********************************************* File Specs ***************************************************/
  155. /* Source File Specs */
  156. resource 'infs' (fsSourceProgram) {
  157.     'APPL',                                /* File Type */
  158.     'Arfz',                                /* Creator */
  159.     kScriptCheckSetsDate,                /* ScriptCheck will fill in the creation date */
  160.     noSearchForFile,                    /* Do not search the source disk for the file */
  161.     typeCrMustMatch,                    /* The file type and creator on source disk must match */
  162.     ProgramDisk1"TheProgram"            /* Path to the file */
  163. };
  164.  
  165. resource 'infs' (fsSourceProgRes1) {
  166.     'rsrc',                                /* File Type */
  167.     'Arfz',                                /* Creator */
  168.     kScriptCheckSetsDate,                /* ScriptCheck tool will fill in the creation date */
  169.     noSearchForFile,                    /* Do not search the source disk for the file */
  170.     typeCrMustMatch,                    /* The file type and creator on source disk must match */
  171.     ProgramDisk2"TheProgramResources"    /* Path to the file */
  172. };
  173.  
  174. /* Target File Specs */
  175. resource 'infs' (fsTargetProgram) {
  176.     'APPL',                                /* File Type */
  177.     'Arfz',                                /* Creator */
  178.     kNoDateStampCheck,                    /* creation date must be zero for target file spec */
  179.     noSearchForFile,                    /* Do not search the target disk for the file */
  180.     typeCrNeedNotMatch,                    /* file to be replaced even if F&C don't match  */
  181.     TargetPath"TheProgram"                /* destination Path */
  182. };
  183.  
  184. /******************************************** File Atoms ************************************************/
  185. resource 'infa' (faProgram) {
  186.     format0 {
  187.         StdRemLeaveNewerCopy,            /* see InstallerCommon.r */
  188.         fsTargetProgram,                /* TARGET file spec for this file */
  189.         fsSourceProgram,                 /* SOURCE file spec for this file */
  190.         0,                                /* atom size (filled in by ScriptCheck) */
  191.         ""                                /* Atom Description (for a file Installer will use file name) */
  192.     };
  193. };
  194.  
  195. /********************************** Resource Atoms **************************************************/
  196. resource 'inra' (raProgramRes1) {
  197.     format0 {
  198.         StdResMake,                        /* See InstallerCommon.r */
  199.         fsTargetProgram,                /* Target file spec to install rsrc into */
  200.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  201.         'CODE',                            /* Resource type */
  202.         17,                             /* Resource source id */
  203.         17,                                /* Resource target id */
  204.         0,                                /* atom size (filled in by ScriptCheck) */
  205.         "",                                /* Atom description */                            
  206.         ""                                /* Resource name */
  207.     };
  208. };
  209. resource 'inra' (raProgramRes2) {
  210.     format0 {
  211.         StdResMake,                        /* See InstallerCommon.r */
  212.         fsTargetProgram,                /* Target file spec to install rsrc into */
  213.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  214.         'CODE',                            /* Resource type */
  215.         16,                             /* Resource source id */
  216.         16,                                /* Resource target id */
  217.         0,                                /* atom size (filled in by ScriptCheck) */
  218.         "",                                /* Atom description */                            
  219.         ""                                /* Resource name */
  220.     };
  221. };
  222.  
  223. resource 'inra' (raProgramRes3) {
  224.     format0 {
  225.         StdResMake,                        /* See InstallerCommon.r */
  226.         fsTargetProgram,                /* Target file spec to install rsrc into */
  227.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  228.         'CODE',                            /* Resource type */
  229.         9,                                 /* Resource source id */
  230.         9,                                /* Resource target id */
  231.         0,                                /* atom size (filled in by ScriptCheck) */
  232.         "",                                /* Atom description */                            
  233.         ""                                /* Resource name */
  234.     };
  235. };
  236.  
  237. resource 'inra' (raProgramRes4) {
  238.     format0 {
  239.         StdResMake,                        /* See InstallerCommon.r */
  240.         fsTargetProgram,                /* Target file spec to install rsrc into */
  241.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  242.         'CODE',                            /* Resource type */
  243.         2,                                 /* Resource source id */
  244.         2,                                /* Resource target id */
  245.         0,                                /* atom size (filled in by ScriptCheck) */
  246.         "",                                /* Atom description */                            
  247.         ""                                /* Resource name */
  248.     };
  249. };
  250.  
  251.  
  252.  
  253.  
  254.